package com.huika.renrench.config;

import com.amap.api.maps.model.LatLng;
import com.huika.renrench.control.common.environment.PreferHelper;
import com.huika.renrench.control.common.environment.SetEnvironmentActivity;
import com.huika.renrench.utils.PreferencesHelper;

/**
 * 网络地址配置
 * 
 * @author fanxing 创建于 Mar 18, 2015
 */
public class UrlConstants {
	public static String ServerName = getServerDomain();
	// 惠卡公司地址
	public static final LatLng HUIKA_LOCATION = new LatLng(22.602686,
			114.057427);

	/** 以下变量在环境切换时需要变更 *****************************************************/
	/** 通用日志标签 */
	public static final String DEBUG_TAG = "RRPlaceholder";
	/** 是否打印日志信息 */
	public static final boolean IS_LOG = true;
	
	/**正式版本的环境*/
	public static final String RELEASE_SERVER_DOMAIN = "http://121.199.22.45:1080/rrcpro-api/";
	/**真实数据的测试环境*/
	public static final String RELEASE_TEST_SERVER_DOMAIN = "http://192.168.16.219:8183/rrcpro-api/";
	/**测试版本的环境*/
	public static final String TEST_SERVER_DOMAIN = "http://192.168.16.219:8082/rrcpro-api/";

//	public static final String HOST = "http://121.199.22.45:1080/rrcpro-api/";
//	public static final String HOST = "http://192.168.16.219:8082/rrcpro-api/";//测试服务器
//	public static final String HOST = "http://192.168.21.103:8080/rrcpro-api/";
	// public static final String HOST ="http://192.168.17.83:8080/rrcpro-api/";
//	public static final String HOST ="http://192.168.17.237:8080/rrcpro-api/";//杨俊
	//public static final String HOST ="http://192.168.16.219:8183/rrcpro-api/";//预生产
	/** 以上变量在环境切换时需要变更 *****************************************************/
	public static final String HOST = ServerName;
	/** 获取项目列表 */
//	public static final String URL_FIND_PROJECTS = HOST + "projectService/GetAllProjectList";
	
	private static final boolean isReleaseEnvironment() {
		return PreferHelper.getInstance().getBoolean(SetEnvironmentActivity.IS_RELEASE_ENVIRONMENT, true);
	}

	private static final boolean isReleaseTestEnvironment() {
		return PreferHelper.getInstance().getBoolean(SetEnvironmentActivity.IS_RELEASE_TEST_ENVIRONMENT, false);
	}
	
	private static final String getServerDomain() {
		if (isReleaseEnvironment()) {
			return RELEASE_SERVER_DOMAIN;
		} else {
			if (isReleaseTestEnvironment()) {
				return RELEASE_TEST_SERVER_DOMAIN;
			} else {
				return TEST_SERVER_DOMAIN;
			}
		}
	}
	
	
	public static String getHost(){
		String hostFlag = PreferencesHelper.getString(PreferencesHelper.KEY_ENVIRONMENT);
		String host = "";
		if (hostFlag.equals("test") || hostFlag.equals("")) {
			host = TEST_SERVER_DOMAIN;
		}else if(hostFlag.equals("pre")){
			host = RELEASE_TEST_SERVER_DOMAIN;
		}else if(hostFlag.equals("official")){
			host = RELEASE_SERVER_DOMAIN;
		}else if(hostFlag.equals("yangjun")){
			host = "http://192.168.17.237:8080/rrcpro-api/";
		}
		return host;
	}
	
	/** 新添加的获取项目接口详情 */
	public static final String URL_PROJECT_DETAIL2 = "http://192.168.16.219:8082/rrcpro-api/projectService/GetUploadProjectDetail";
	/**新添加项目 关注详情*/
	public static final String ADDCOLLECT2 = "http://192.168.16.219:8082/rrcpro-api/loanInvestService/AttionPro";
	
	/** 获取项目详情 */
	public static final String URL_PROJECT_DETAIL = HOST
			+ "projectService/GetProjectDetailForApp";
	/** 用户-获取软件更新信息 */
	public static final String GETVERSIONINFO = HOST + "commonService/GetVersionInfo";
	/**用户-修改头像*/
	public static final String UPLOADIMG = HOST + "imageService/UploadImg";
	/**用户-修改头像*/
	public static final String UPLOADUSERIMG = HOST + "userservice/UploadUserImg";
	/**用户-更新用户信息*/
	public static final String FINDUSERBYUSERID = HOST + "userservice/FindUserByUserId";
	/**意见反馈*/
	public static final String PUBLISHFEEDBACK = HOST + "commonService/PublishFeedback";
	/**我的预约*/
	public static final String GETRESERVEINVEST = HOST + "loanInvestService/GetReserveInvest";
	/**我的投资*/
	public static final String GETMYINVEST = HOST + "loanInvestService/GetMyInvest";
	/**债权转让*/
	public static final String ADDTRANSFER = HOST + "loanInvestService/AddTransfer";
	/**我的收藏删除*/
	public static final String DELETECOLLECT = HOST + "commonService/DeleteCollect";
	/** 获取开户银行列表 */
	public static final String GETBANKLIST = HOST + "userservice/GetBankList";
	/** 我的银行卡列表 */
	public static final String GETMYBANKCARDLIST = HOST
			+ "userservice/GetMyBankCardList";
	/** 添加我的银行卡信息 */
	public static final String ADDBANKCARD = HOST + "userservice/AddBankCard";
	/** 我的收藏 */
	public static final String GETCOLLECTLIST = HOST + "commonService/GetCollectList";
	/** 邀请奖励 */
	public static final String MYREWARDS = HOST + "userservice/MyRewards";
	/** 我成功邀请列表 */
	public static final String MYINVITES = HOST + "userservice/MyInvites";
	/**	删除银行卡*/
	public static final String DELETEBANKCARD = HOST + "userservice/DeleteBankCard";
	/**	实名验证*/
	public static final String REALNAMEAUTHENTICATION = HOST + "userservice/RealNameAuthentication";
	/** 获取投资池信息 */
	public static final String GETPOOLINFO = HOST
			+ "loanInvestService/GetPoolInfo";
	/** 获取投资去向 */
	public static final String GETLOANPROJECTLIST = HOST
			+ "loanInvestService/GetLoanProjectList";
	/** 确认投资 */
	public static final String ADDINVEST = HOST + "loanInvestService/AddInvest";
	/** 借款详情 */
	public static final String GETLOANPROJECTDETAIL = HOST
			+ "loanInvestService/GetLoanProjectDetail";
	/** 交易记录 */
	public static final String GETTRANSACTIONLIST = HOST
			+ "userservice/GetTransactionList";
	/** 获取项目列表 */
	public static final String URL_FIND_PROJECTS = HOST
			+ "projectService/GetProjectListForApp";
	/** 获取项目分类列表 */
	public static final String GETPROJECTTYPELIST = HOST
			+ "projectService/GetProjectTypeList";
	/** 获取项目地区列表 */
	public static final String GETAREALIST = HOST
			+ "commonService/GetAreaList";
	/** 获取项目学费列表 */
	public static final String GETLEARNPRICCE = HOST
			+ "projectService/GetLearnPrice";
	/**店铺转让新增/修改*/
	public static final String UPDATEORADDSHOP = HOST + "shopRentService/SaveOrUpdateShop";
	/**	店铺转让-图片上传*/
	public static final String UPLOADSHOPIMG = HOST + "imageService/UploadShopImg";
	/**店铺转让详情*/
	public static final String GETSHOPSTOREDETAIL = HOST + "shopRentService/GetShopStoreDetail";
	/**账户资产*/
	public static final String GETUSERTOTALAMOUNT = HOST + "userservice/GetUserTotalAmount";
	/**广告信息(广告滚动图片)*/
	public static final String GETADVERTISEMENTINFO = HOST + "commonService/GetAdvertisementInfo";
	/**登陆验证*/
	public static final String LOGINVALIDATEFORUSERAPP = HOST + "userservice/LoginValidateForUserApp";
	/**注册-获取短信验证码*/
	public static final String GETSMSVERIFICATION = HOST + "userservice/GetSMSverification";
	/**注册*/
	public static final String REGISTER = HOST + "userservice/Register";
	/**找回密码-获取短信验证码*/
	public static final String GETFINDPASSWORDSMSCODE = HOST + "phoneMessage/GetFindPasswordSmsCode";
	/**找回密码-验证码识别*/
	public static final String FINDPASSWORDCHECKCODE = HOST + "phoneMessage/FindPasswordCheckCode";
	/**找回密码-重新设置密码*/
	public static final String FINDPASSWORDRESET = HOST + "phoneMessage/FindPasswordReset";
	/**绑定手机-发送验证码*/
	public static final String GETMSGBINDNEWPHONEGETCODEREQ = HOST + "phoneMessage/GetMsgBindNewPhoneGetCodeReq";
	/**绑定手机*/
	public static final String BANDINGPHONE = HOST + "userservice/BandingPhone";
	/**更新绑定手机发送验证码(确认原绑定手机是否准确)*/
	public static final String GETMSGBINDCHANGEPHONEGETCODEREQ  = HOST + "phoneMessage/GetMsgBindChangePhoneGetCodeReq";
	/**更绑手机-验证（确认原绑定手机是否准确）*/
	public static final String CHANGEPHONECHECK  = HOST + "phoneMessage/ChangePhoneCheck";
	/**修改登陆密码*/
	public static final String CHANGELOGINPASSWORD  = HOST + "userservice/ChangeLoginPassword";
	/**项目分类列表*/
	public static final String GETPROTYPE  = HOST + "projectService/GetProType";
	/**借款管理列表*/
	public static final String GETLOANLIST  = HOST + "loanInvestService/GetLoanList";
	/**借款管理列表*/
	public static final String GETMYLOANLIST  = HOST + "loanInvestService/GetMyLoanList";
	/**店铺转让列表*/
	public static final String GETSHOPSTORELIST  = HOST + "shopRentService/GetShopStoreList";
	/**项目新增或者修改*/
	public static final String UPDATEORADDPROJECT  = HOST + "loanInvestService/UpdateOrAddProject";
	/**店铺修改、删除、下架*/
	public static final String GETSHOPUPDATE  = HOST + "shopRentService/GetShopUpdate";
	/**项目图片上传*/
	public static final String UPLOADPROJECTIMG  = HOST + "imageService/UploadProjectImg";
	/**我要预约/取消预约*/
	public static final String UPDATEINVEST = HOST + "loanInvestService/UpdateInvest";
	/**我要自投资/取消自投*/
	public static final String UPDATEAUTOLOAN = HOST + "loanInvestService/UpdateAutoLoan";
	/**修改密码获取短信验证码(交易密码*/
	public static final String GETFINDPAYPASSWORDSMSCODE = HOST + "phoneMessage/GetFindPayPasswordSmsCode";
	/**交易密码（修改或者设置）*/
	public static final String SETOEDITPAYPWD = HOST + "userservice/SetOEditPayPwd";
	/**获取网页链接地址*/
	public static final String GETWEBURLLIST = HOST + "commonService/GetWebUrlList";
	/**项目图片上传*/
	public static final String UPLOADIMGVALIDATE = HOST + "merchantInfoService/UploadImgValidate";
	/**店铺收藏，商家关注*/
	public static final String ADDCOLLECT = HOST + "commonService/AddCollect";
	/**投资记录*/
	public static final String GETINVESTINFOLIST = HOST + "loanInvestService/GetInvestInfoList";
	/**充值订单*/
	public static final String INSERTORDER = HOST + "userservice/insertOrder";
	/**获取提示信息*/
	public static final String GETTIP = HOST + "userservice/getTip";
	/**提现申请*/
	public static final String ACCOUNTWITHDRAW = HOST + "userservice/AccountWithdraw";
	/**删除图片*/
	public static final String DELETIMAGE = HOST + "loanInvestService/DeletImage";
	/**用户交易详情*/
	public static final String GETTRANSACTIONDETAIL = HOST + "userservice/GetTransactionDetail";
	/**我投递的项目详情*/
	public static final String INVESTMENT_PROJECT_DETAIL = HOST + "userservice/MyUploadProjectDetail";
	/**3.76.	我的推荐奖励详情（10-20 樊星）**/
	public static final String MYREWARD_ORDER_DETAIL = HOST + "userservice/MyRewardOrderDetail";
	/**投递项目**/
	public static final String UPLOADPROJECT = HOST + "projectService/UploadProject";
	
}
